package com.engine.salary.service;

import com.engine.salary.common.LocalDateRange;
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
import com.engine.salary.entity.salaryarchive.dto.SalaryItemAdjustRecordListDTO;
import com.engine.salary.entity.salaryarchive.param.SalaryArchiveItemSaveParam;
import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustBeforeParam;
import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustRecordQueryParam;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 薪资档案-薪资项目
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public interface SalaryArchiveItemService {

    /**
     * 获取单个薪资档案项目调整记录
     *
     * @param salaryArchiveItemId
     * @return
     */
    SalaryArchiveItemPO getById(Long salaryArchiveItemId);

    /**
     * 获取可以调整的薪资项目
     */
    List<SalaryItemPO> getCanAdjustSalaryItems();

    /**
     * 获取薪资项目调整前的值
     *
     * @param adjustBeforeParam
     */
    String getSalaryItemAdjustBeforeValue(SalaryItemAdjustBeforeParam adjustBeforeParam);


    /**
     * @description 根据薪资档案id和薪资项id获取薪资项目（生效+不生效）
     * @return List<SalaryAtemPO>
     * @author Harryxzy
     * @date 2022/11/14 17:07
     */
    List<SalaryArchiveItemPO> getSalaryItemsBySalaryArchiveIdAndItemIds(Long salaryArchiveId, List<Long> salaryItemPageIds);

    /**
     * 获取当前已生效
     *
     * @param salaryArchiveId
     * @param salaryItemPageIds
     */
    List<SalaryArchiveItemPO> getEffectiveSalaryItems(Long salaryArchiveId, List<Long> salaryItemPageIds);

    /**
     *  调薪前置校验
     * @param saveParam
     * @return
     */
    String checkSaveSalaryItem(SalaryArchiveItemSaveParam saveParam);

    /**
     * 保存薪资项目调整
     *
     * @param saveParam
     * @return
     */
    String saveSalaryItem(SalaryArchiveItemSaveParam saveParam);

    /**
     * 删除薪资项目调整
     *
     * @param salaryArchiveItemId
     * @return
     */
    String deleteSalaryItem(Long salaryArchiveItemId);

    /**
     * 薪资调整记录列表（分页）
     *
     * @param queryParam
     * @param salaryItemIds
     * @return
     */
    PageInfo<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordListPage(SalaryItemAdjustRecordQueryParam queryParam, List<Long> salaryItemIds);

    /**
     * 薪资调整记录列表
     *
     * @param queryParam
     * @param salaryItemIds
     * @return
     */
    List<SalaryItemAdjustRecordListDTO> salaryItemAdjustRecordList(SalaryItemAdjustRecordQueryParam queryParam, List<Long> salaryItemIds);

    /**
     * 导出薪资项目的调整记录列表
     *
     * @param queryParam
     */
    XSSFWorkbook exportAdjustRecordList(SalaryItemAdjustRecordQueryParam queryParam);



    /**
     * 获取薪资档案对应的当前生效的薪资项目
     *
     * @param salaryArchivesIds
     * @return
     */
    List<SalaryArchiveItemPO> getCurrentEffectiveItemList(Collection<Long> salaryArchivesIds, Collection<Long> salaryItemIds);


    /**
     * 获取薪资档案对应的当前生效的薪资项目忽略值
     *
     * @param salaryArchivesIds
     * @param salaryItemIds
     * @return
     */
    List<SalaryArchiveItemPO> getCurrentEffectiveItemListIngoreValue(Collection<Long> salaryArchivesIds, List<Long> salaryItemIds);

    /**
     * 获取当前已生效
     *
     * @param salaryArchiveIds
     * @param isNoNeedSalaryItem
     * @param salaryItemIds
     * @return
     */
    Map<String, List<SalaryArchiveItemPO>> getEffectiveItemListMap(Collection<Long> salaryArchiveIds, boolean isNoNeedSalaryItem, Collection<Long> salaryItemIds);

    /**
     * 获取当前未生效
     *
     * @param salaryArchiveIds
     * @param isNoNeedSalaryItem
     * @param salaryItemIds
     * @return
     */
    Map<String, List<SalaryArchiveItemPO>> getIneffectiveItemListMap(Collection<Long> salaryArchiveIds, boolean isNoNeedSalaryItem, Collection<Long> salaryItemIds);


    /**
     * @description 单个档案的薪资项目调整的编辑
     * @return String
     * @author Harryxzy
     * @date 2022/11/14 13:38
     */
    String editSingleSalaryItem(SalaryArchiveItemSaveParam salaryArchiveItemSaveParam);


    ArchiveFieldConfig getConfig();

    UploadConfigResponse.Result parseConfig(ArchiveFieldConfig config);

    /**
     * 根据薪资档案id和生效日期范围获取数据
     *
     * @param salaryArchiveIds
     * @param dateRange
     * @return
     */
    List<SalaryArchiveItemPO> listByArchiveIdAndEffectiveTime(List<Long> salaryArchiveIds, LocalDateRange dateRange);
}
